package com.wangge.proxy.interfaceCase;

import java.util.HashMap;
import java.util.Map;

/** 貌似成工厂方法了
  * date: 2016年11月9日 下午4:23:25 <br/> 
  * 
  * @author yangqc 
  * @version  
  * @since JDK 1.8 
  */  
public class WaiterProxy {
  Map<String, Waiter<?>> waiterMap = new HashMap<>();
  {
    waiterMap.put("restaurant", new RestaurantWaiter());
    waiterMap.put("hotel", new HotelWaiter());
  }
  
  public Waiter<?> getService(String place) {
    return waiterMap.get(place);
  }
  
  @SuppressWarnings("unchecked")
  public static void main(String[] args) {
    WaiterProxy proxy = new WaiterProxy();
    Waiter<Integer> hotelWaiter = (Waiter<Integer>) proxy.getService("hotel");
    hotelWaiter.service(12);
    
  }
}
